from rest_framework import routers
from django.urls import re_path
from .views import *


urlpatterns = [
    # 问题排序获取
    re_path('^questions/(?P<id>[-\d]+)/label/(?P<condition>\w+)/$', QuestionOrderView.as_view()),
]


router = routers.SimpleRouter()
# 标签
# prefix前缀，自动拼接视图中的/函数名/形成路径
router.register(prefix='labels', viewset=LabelViewSet, base_name='label')

# 创建问题与问题详情
router.register(prefix='questions', viewset=QuestionView, base_name='question')

# 回答问题
router.register(prefix='reply', viewset=ReplyViewSet, base_name='reply')


urlpatterns += router.urls